<!DOCTYPE html>
<html lang="zh-CN">
	<head>
		<meta charset="UTF-8" />
		<meta name="viewport" content="width=device-width, initial-scale=1.0" />
		<title>042-定位的特殊应用2</title>
		<style>
			.box {
				width: 400px;
				height: 400px;
				background-color: gray;
				position: relative;
			}

			.inner {
				width: 100px;
				height: 100px;
				background-color: pink;
				/* 方案一 */
				/* position: absolute;
				top: 0;
				left: 0;
				right: 0;
				bottom: 0;
				margin: auto; */

				/* 方案二 */
				position: absolute;
				top: 50%;
				left: 50%;
				transform: translate(-50%, -50%);
			}
		</style>
	</head>
	<body>
		<div class="box">
			<div class="inner"></div>
		</div>
	</body>
</html>
